package com.example.alldemo.controller;

import com.example.alldemo.rabitmq.Sender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@Controller
@WebFilter("/*")
public class RabitController {
    int count = 0;

    @Autowired
    Sender sender;

    @RequestMapping("/sender")
    @ResponseBody
    public String sender(){
        System.out.println("send string:hello world");
        count = count + 1 ;//用以测试工作模式中的公平分配方式
        sender.send("hello world"+count);
        return "sending...";
    }
}
